package com.lkd.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lkd.entity.VmType;
import com.lkd.mapper.VmTypeMapper;
import com.lkd.service.VmTypeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lkd.vo.PageBean;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 售货机类型表 服务实现类
 * </p>
 *
 * @author author
 * @since 2024-08-20
 */
@Service
public class VmTypeServiceImpl extends ServiceImpl<VmTypeMapper, VmType> implements VmTypeService {

    @Override
    public PageBean<VmType> search(String name, Integer pageIndex, Integer pageSize) {
        Page<VmType>page=new Page<>(pageIndex,pageSize);
        LambdaQueryWrapper<VmType> wrapper = new LambdaQueryWrapper<>();
        wrapper.like(BeanUtil.isNotEmpty(name),VmType::getName,name);
        page=getBaseMapper().selectPage(page,wrapper);

        return new PageBean<>(page);
    }
}
